package org.example.autofilearchiver.Web.Controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.example.autofilearchiver.tool.StaticClass.PDf.PDFStatic;
import org.example.autofilearchiver.toolclass.PDF.PdfPath;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/pdf")
@Api(tags = "pdf文件相关接口")
public class PdfController {
    /**
     * 接收前端传入pdf的文件路径
     *
     * @param pdfPath pdf文件的绝对路径
     * @return 接受成功消息
     */
    @PostMapping("/postString/pdfPath")
    @ApiOperation(value = "pdf文件传入接口", notes = "传入pdf文件夹的绝对路径")
    public String handlePdfPath(@RequestBody PdfPath pdfPath) {
        PDFStatic.pdfPath = pdfPath.getFolderPath();//把路径存到全局数据里
        // 返回一个简单的响应，表示文件路径已收到
        return "Received pdf path: " + pdfPath;
    }


}
